<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数组</title>
</head>
<script>
    let arr1 = [12,15,56,78];
    console.log(arr1);
    console.log(arr1[2]);
    console.log([56,25,36]);
    let arr2 = new Array(10);
    console.log(arr2);
    console.log(arr2.length);
    let arr3 = new Array(99,53,28);
    console.log(arr3);
    arr3.length=20;
    console.log(arr3.length);
    console.log(arr3[0],arr3[6]);
    arr3[29]=18;
    console.log(arr3);
    //遍历
    let sum = 0;
    for (let i = 0; i < arr1.length; i++) {
        console.log(arr1[i]);   
        sum+=arr1[i];
    }
    console.log(`平均值为${sum/arr1.length}`)
</script>
<body>
    
</body>
</html>